Skip to content

fix(staged): make branch setup the only path to Running so a Blox clone is never left on main - #1091

Open
matt2e wants to merge 9 commits into
mainfrom
blox-sometimes-has-main-checked-out
Open

matt2e wants to merge 9 commits into
mainfrom
blox-sometimes-has-main-checked-out

Conversation

@matt2e

@matt2e matt2e commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Summary

A Blox workstation could end up on main with its branch marked running: start_workspace swallowed a failed sq blox ws start or checkout, and the status pollers then promoted the row from what Blox reported about the workstation. Sessions then ran on the base branch.

This makes branch setup the only code that moves a remote branch from Starting to Running, verifies the clone before anything runs in it, and lets the backend own setup, retries and failure reporting.

Setup owns Running

  • New workspace_setup module (split into host, clone, workstation, checkout, verify, retry, failures, poll, guard) shared by the Tauri commands and the web server arms.
  • Running is written only by setup, after the clone has been read as on the branch. A failed ws start, a failed checkout, a detached HEAD or an unreadable clone fails the row to Error with the reason.
  • The pollers no longer promote Stopped/Suspended/statusless rows; they write Starting and trigger setup. A booting workstation is waited for, not started again.
  • Project transfer marks Running only the rows its own inspection read as on their branch.

Checks before anything runs in the clone

  • Every session start (fresh, queued, resumed, claimed) reads the clone's HEAD with one transient exec before claiming the row. On a mismatch it repairs under the shared guard instead of failing, and refuses to switch a clone another live session is working in. An unanswered read is neither answer and is retried once.
  • Commit, rebase, squash, push, pull and pull-request pipelines make the same check before their git steps. The PR pipeline names the local branch rather than HEAD and stops before any agent step when the branch does not exist.
  • A per-clone gate keeps session starts and checkouts from interleaving.

The checkout never loses or moves work

  • Commits stranded on the base branch that no other branch or origin owns come along to a new branch. Any switch that would leave commits behind, carry a dirty tree across, or orphan a detached HEAD is refused with a message naming the branches and commits.
  • A refused repair of a Running row puts it back to Running and fails only the session that asked.

Backend-owned retries and failure reporting

  • start_workspace only asks for setup and returns at once; the row and a workspace-setup-error event (with userRequested) say how it ended. The frontend drops its setup queue and five-minute timeout and raises a toast only for user-requested runs.
  • Every Error write arms a jittered retry timer (1 min → 30 min) that runs only when Blox reports the workstation running and never starts one. A startup pass picks up rows left Starting or Error. The remote error view gains a Retry button.
  • A queue held behind a sibling branch's disconnected session asks the reconcile service once per cause, is bounded to one holder attempt per minute, keeps those attempts out of the holder's backoff, and takes its "Queued session is waiting" toast down on release (including branch deletion).

Tests

Fake-host behaviour tests for setup, checkout refusals, verify, retry schedule, sessions and polling; source-text wiring tests that fail if a trigger, check call or effect is deleted or anything outside setup writes Running; reconcile and queue tests for the hold; vitest coverage for the lifecycle, status view and listener changes.

No data model changes.

🤖 Generated with Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T04:14:13.038291Z e294151 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e29415101e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +1992 to +1993
crate::workspace_setup::verify::ensure_session_checkout(app_handle, store, &branch, session_id)
.await

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Allow resuming the session that owns an interrupted rebase

When a remote rebase session is stopped while resolving conflicts, resuming it now routes its detached HEAD through ordinary checkout repair. checkout::guard_leaving refuses a detached HEAD with rewritten commits that no ref reaches, so a rebase that successfully replayed a commit before encountering a conflict cannot be resumed to resolve that conflict. This breaks the recovery flow explicitly supported by session_runner::detect_session_commit, which leaves mid-rebase artifacts pending for a later resumed turn. Recognize an in-progress rebase belonging to the requested branch and permit its owning session to continue without switching the checkout.

Useful? React with 👍 / 👎.

let plan = prepare_resume(&store, &session, branch_id, acp_config_selection).await?;
// Held until this returns, by when the row is `running` and visible to
// any checkout that would otherwise run in the clone.
let _checkout = ensure_resume_checkout(&app_handle, &store, &plan, &session_id).await?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Capture the resume baseline after checkout repair

When a resumed commit session finds the shared clone on a sibling branch, prepare_resume has already captured that sibling's HEAD in plan.pre_head_sha before this new check repairs the checkout. The resumed turn consequently runs on the requested branch with the wrong commit-detection baseline. Even if the agent makes no commit, detect_session_commit sees the checkout switch as a HEAD change and can associate an existing branch-tip commit with the resumed session. Capture or refresh the baseline while holding the verified checkout, after any repair; the claimed and requeued resume paths have the same ordering.

Useful? React with 👍 / 👎.

matt2e and others added 9 commits November 20, 2026 15:44
A Blox workstation could end up on `main` with its branch marked
`running`: `start_workspace` swallowed a failed `sq blox ws start` and a
failed checkout, and the status pollers then promoted the row from what
Blox reported about the workstation. Sessions started on the base branch.

Requested: branch setup becomes the only code that moves a remote branch
from `Starting` to `Running`, never reports success without the branch
checked out, and is re-triggered from the backend whenever a workstation
is running while its row is still `Starting`.

How:

- New `workspace_setup` module holds one setup routine, shared by the
  Tauri commands and the web server arms (`start_workspace`,
  `setup_remote_repo_clone`). Fresh and existing workstations both end in
  the idempotent `check_out_workspace_branch`. `Running` is written only
  after the checkout succeeded; a failure is returned and the row goes to
  `Error`.
- A non-auth, non-onboarding failure or timeout of `sq blox ws start` no
  longer returns Ok. Setup waits a bounded time for the workstation to
  report running and then checks out, or fails with the start error. A
  workstation that is already booting is waited for, not started again.
- `check_out_workspace_branch` asks `ls-remote` whether the branch is on
  origin, so a failed exec is an error and not "branch missing".
- The single and batch status pollers moved to `workspace_setup::poll`
  and are shared with the web server. They no longer promote `Starting`;
  when the workstation is running and the row is still `Starting` they
  trigger setup. They also leave an `Error` row alone while the
  workstation runs, so a failed setup is not promoted by the next poll.
  Other transitions and the secondary-clone hold are unchanged.
- A per-process guard joins concurrent callers for one branch onto one
  run and serialises runs per workstation, so the frontend call, a
  poller trigger, a second window or web client and the startup pass
  never run two checkouts in one clone. Joiners get the same result and
  write nothing.
- A backend startup pass re-runs setup for branches a previous run left
  in `Starting`. `resume_workspace` triggers setup from the backend once
  the resume succeeded.
- Frontend: the 5 minute starting timeout no longer fires while the
  controller's own setup call is pending or queued, and a resolved setup
  call marks the branch running without waiting for the next poll.

Tests cover the swallowed-failure path ending in a checkout or a visible
error, the pollers triggering setup instead of promoting, the guard
joining concurrent callers, and the startup pass, all through a fake
host and the `GitRunner` injection, with no `sq` call.

Not in this commit: verifying HEAD at session start and hardening the
`rev-parse` probe in `check_out_workspace_branch`.

Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
…ore an agent starts

Follow-up to 0e0fdb4, which made branch setup the only path from
`Starting` to `Running`. Two holes were left: nothing read the clone's
HEAD, so a `Running` row still rested on a checkout reporting success,
and a branch that was never set up, resumed outside Staged and promoted
from `Stopped` or `Suspended` by a poller, could still run sessions on
`main`. The checkout routine's local-branch probe also read any failed
exec as "branch missing".

Requested: confirm the clone's checked-out branch at the end of setup
and at remote session start, never start an agent on the wrong branch,
never let a failed exec read as either answer, and make the
local-branch probe tell "missing" from a failed exec. One cheap exec per
session start, no fetch.

How:

- New `workspace_setup::verify`. The clone's HEAD is read with one
  transient exec of a script that answers on stdout: `branch <ref>`,
  `detached` or `norepo`. Anything else, and any failed exec, is an
  error and never an answer.
- End of setup: after the checkout, the clone must read as on the
  branch before `Running` is written. A mismatch or an unreadable clone
  is a setup failure and the row goes to `Error`.
- Session start: fresh branch sessions (immediate and queued) and
  resumed ones (manual, claimed and re-queued) make the same read before
  anything else reads the clone and before the row is claimed.
- On a mismatch the session start repairs instead of failing. It runs
  the shared setup under the guard with a new `SetupTrigger::Repair`,
  then reads the clone again and starts only on a read that matches.
  Failing outright would end every session queued on the branch in turn
  with the same error, and nothing else asks for setup of a `Running`
  branch. During the repair the row is `Starting`, and `Error` if it
  fails, so the session queue's existing gate holds the rest of the
  queue. The session that asked fails with the expected and the actual
  branch and the cause.
- The repair is refused when another live session works in the same
  clone (two branches of one repository share a clone). The start fails
  with both branch names rather than check out under a running agent.
- A read that does not answer is retried once after 2 s, each attempt
  capped at 30 s, and then fails the start. It triggers no checkout and
  does not let the agent start. A queued start also gets the queue's own
  bounded pre-claim retries.
- `check_out_workspace_branch` asks `for-each-ref` whether the clone has
  the branch. It exits 0 either way and prints the ref only when it
  exists, so a failed exec is now an error instead of a `checkout -B`
  from the base that would move an existing branch off its unpushed
  commits.

Tests, through the fake host and the `GitRunner` injection, with no
`sq` call: the probe script against real clones, setup refusing
`Running` over a wrong or unreadable clone, the session start reading
once, repairing a clone left on `main`, failing visibly when the repair
fails, treating an unanswered read as neither answer, refusing to switch
a clone a live session works in, and the failed local-branch probe
leaving the branch untouched.

Not in this commit: pipeline sessions (rebase, squash, push, PR) do not
make this check before their git steps, and a reattach to an agent that
is already running does not either.

Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
…h a verified checkout

Applies the review of 0e0fdb4 and ee35d45. Requested: a retry path out
of `Error`, no unverified write of `Running`, a checkout that never loses
or moves work, an atomic session-start check scoped to the clone, a
`start_workspace` whose answer means what it says, the same check for
pipelines, and tests for the wiring.

Error has a way out
- The remote error view has a Retry button, which asks for setup again.
- Every write of `Error` sets a retry timer in the backend, backed off
  from one minute to thirty. It runs setup only when Blox reports the
  workstation running and never starts or resumes one, so a branch with
  no window open recovers too. The startup pass arms it for rows a
  previous run left in `Error`.
- The reason for a failure is kept in memory and emitted as a
  `workspace-setup-error` event, with `get_workspace_setup_errors` for a
  window that missed it. It covers runs no frontend call was joined to:
  the startup pass, poll-triggered runs, retries, a failed resume and a
  poll that itself moves a row to `Error`. No database field was added.

Running is written only over a verified checkout
- The pollers no longer promote a `Stopped`, `Suspended` or statusless
  row whose workstation is running. They write `Starting` and trigger
  setup, which also closes the two-poll `Starting`, `Suspended`,
  `Running` route.
- A project transfer that resumed a workspace marks `Running` only the
  rows its own inspection read as on their branch.
- Commit, rebase, squash, push, pull request and pull pipelines read the
  clone before their git steps, as agent starts do.

The checkout neither loses nor moves work
- A clone on the base branch with commits that are on no other branch
  and not on origin, for a branch that exists nowhere, has the branch
  created from HEAD. The commits come along and local base is not reset
  or moved.
- Any other switch that would leave commits behind, carry uncommitted
  changes onto another branch or orphan a detached HEAD is refused with
  a message naming the branches and the commits.
- A refused repair of a row that was `Running` puts it back to `Running`
  and fails only the session that asked.

Session starts and checkouts do not interleave
- A per-clone gate is held by setup over its checkout and by an agent or
  pipeline start from its read of the clone until its row is live.
- The live-session scan covers every branch in the clone on that
  workstation, across projects.
- A `disconnected` session is handed to the reconcile service at once
  and waited on for a bounded time, so it stops blocking once settled.

A caller gets the answer to what it asked
- `start_workspace` returns the row's resulting status. A caller that
  joined another trigger's run which did nothing runs its own.
- The call returns `starting` while the run waits for a workstation to
  boot or for its turn on one, so the bounded wait after a failed
  `ws start` no longer holds a frontend setup slot. The frontend leaves
  such a branch to the backend and applies no timeout of its own.

Tests
- Source-text wiring tests fail when a trigger, an effect or a
  session-start or pipeline check call is deleted, and pin that nothing
  outside setup writes a literal `Running`.
- Behaviour tests cover the retry schedule, the stranded-commit repair
  and each refusal, the clone gate, disconnected sessions, cross-project
  scope, joined callers and the early return.
- `a_poll_still_owns_the_other_transitions` no longer assumes a
  suspended row was set up before.

`workspace_setup.rs` is split into `host`, `clone`, `workstation`,
`checkout`, `retry` and `failures` submodules.

Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
… retries quiet

The second review of this branch asked for less machinery around setup
and for retries that nobody asked for to stop being visible. This applies
its simplification of workspace_setup.rs, its first warning and the two
small suggestions on the frontend timeout and on stale failure reasons.
The other four warnings are left for a later commit.

start_workspace now only asks. It returns once the run is under way or
joined, the row and the workspace-setup-error event say how the run
ends, and no client call waits on a setup. That removes the Patience and
Progress machinery, the Queued and WaitingForWorkstation guard states
and the early-return branch in the backend, and backendSetupBranches,
the four-slot remote queue and the five-minute starting timeout in the
frontend. The invariant is unchanged: Running is written only by setup,
over a clone it read.

Failures reach the UI through the reason event and query. The event
carries userRequested, set for a setup the user asked for (a new branch,
the error view's Retry, a resume), and the frontend raises a toast only
for those. A startup pass, a poll-triggered run and an automatic retry
fail into the card only.

An automatic retry no longer flips the card or blanks its reason: the
row stays Error with its reason until the checkout has passed. The timer
looks at the workstation before taking a slot in the guard, which shrinks
the joined-run loop to one second look. A retry that the user's Retry or
a resume joined while it waited for its turn becomes that run. A
checkout refused over what is in the clone sets no timer and is left to
the Retry button; a live session or a workstation that is down still
does (CheckoutError::Blocked). Retry timers wait up to a fifth longer,
at random, so a restart does not retry every failed branch in one
instant.

A stored reason is dropped when its branch is gone or no longer in
Error, at the retry timer and whenever a failure is recorded, and a
reason that has not changed is not announced again.

Tests: the request, retry and wiring tests are adapted to the new
entry points, with new ones for a request that returns at once, a quiet
failed retry, a refusal that sets no timer, jitter, what the reason store
announces, and a frontend told about an automatic retry failing without
a toast.

Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
…more review warnings

Review f28fe49a left four warnings open after 67dffa0. This closes them
with the least code each needs, and adds the tests the review listed as
missing for them.

A refused repair no longer ends a branch's queued sessions one after
another. A clone a sibling branch's session works in is not repaired at
all: the branch stays Running, the asking session fails with a message
that names the sibling's session, and the drain holds the row. A held
row spends no queue attempt, is asked about again from the database
every five seconds, and is released when the sibling's session is done.
A start that leaves the branch out of Running spends no attempt either.
A repair refused over what is in the clone (changes in the way, commits
that would be left behind) now leaves the branch in Error with its
reason and no timer, where the queue already holds and Retry releases
it, in place of the Running that 53fb152 wrote back.

Commits stranded on the local base are adopted only when the owner can
be told. Setup refuses when another branch row sharing the clone has no
local branch either. It also refuses when not every stranded commit was
made by `git commit` in this clone, read from HEAD's reflog: ancestry
cannot tell a force-pushed base from one that moved on, and the reflog
shows whether the commits were written here or fetched. When commits
are adopted the user is told through the workspace-setup-error event,
which gains an optional notice the frontend shows as a toast.

Rows a transfer resumed and did not read as on their branch are written
Starting, and setup is asked for them once the transfer has ended, so
they no longer sit Suspended or Stopped on a running workstation.

Push no longer checks that HEAD is on the branch, run now or from the
queue: it pushes an explicit refspec. The pull request pipeline keeps
the read and goes on when the repair cannot run. Commit, rebase, squash
and pull keep the check.

No data model changes.

Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
…the last review items

Applies the two warnings of the last review and the two small gaps it
names. Nothing else from that review is taken up here.

Pull request pipeline. The history and changed-files steps and every
prompt an agent can be handed now name the local branch instead of HEAD,
as the push's refspec already did, so the pipeline describes its own
branch from a clone that is on a sibling branch or on the base. With
that, the pipeline no longer reads what the clone has checked out and no
longer asks for a repair. When the local branch does not exist, a new
first step stops the pipeline before any step that can hand off to an
agent: the session ends in error with the reason, no agent starts and
nothing in the clone changes. An agent is therefore never handed a
failed push to fix by creating the branch setup refused to create. The
aborted pipeline now reports the step's words as the session error, and
the pull request error shown to the user carries that reason.

Queue hold. A queued row held behind a sibling branch's session now
tells the user why, once per cause, as a notice on the existing
workspace setup event with its own heading. On the first look and on
each recheck a disconnected holder is handed to the reconcile service,
so the hold does not wait out the reconciler's backoff.

Transfer early exits. A transfer that is cancelled right after a resume,
or whose second inspection fails, now writes Starting for the rows of
the workspaces it resumed before returning, so setup picks them up.

Sibling rule. Only sibling branch rows that have had a session count as
possible owners of commits stranded on the base. A sibling that never
ran one cannot have committed there and no longer makes the owner
unclear. The test that pinned the stricter rule now gives the sibling a
session, and new tests cover the sibling without one.

No data model changes: one new store query, no new fields or types in
the schema.

Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
…the hold toast down on release

Applies the one warning and the one suggestion of the review of
89e135d, and nothing else.

Reconcile throttling. A queued row held behind a sibling branch's
`disconnected` session asked the reconcile service on every look, with
the "Check now" trigger that skips every spacing the service keeps, and
the hold is looked at again every five seconds. That was a Blox call, a
log line and two events every five seconds for as long as the hold
lasted. The holder is now named for the service only when the cause is
new: on the first look, and when the holder goes from running to
disconnected. The rechecks are a database read again, and the service's
own sweep, held-work recheck and workspace-reachable nudge look at the
session after that. The comment on `QUEUE_HOLD_RECHECK` says so.

Hold toast. The "Queued session is waiting" toast had no id and nothing
took it down. It now has one id per branch, so a new cause replaces the
old toast instead of stacking another. The backend takes the notice
back when the hold ends: when a look finds nothing holding the row, and
when a held row has left the queue (stopped or force-started). It sends
the same event with the heading and no notice, and the frontend
dismisses the toast on it. Clearing a branch's state dismisses it too.
The adopted-commits notice is unchanged and stays sticky.

`QueuedStartAttempts` gains `release`, and `retain_queued` reports
whether it dropped a held row. No data model changes and no new event.

Tests: the hold test now pins one ask per cause across rechecks and a
running/disconnected flap, and one take-back event on release. The
attempts test covers `release` and the pruned held row, the wiring test
pins both take-back call sites, and the vitest file covers the toast
id, the replacement and both dismissals.

Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
…elease the hold toast with its branch

Applies the warning and the suggestion of the review of f8e6a82, and
nothing else. The two other missed-release cases that review lists (a
branch that is not Running or is being transferred, and a backend
restart under an open web client) are left as they are.

Bounded wait. A queued row held behind a sibling branch's
`disconnected` session asked the reconcile service once per cause, and
then waited for that service's own schedule. When the holder's attempts
had been failing, that schedule is a backoff of up to thirty minutes,
so the row could wait about 31 minutes after the cause had cleared. A
second disconnected session of the same sibling branch becoming the
holder was not asked about at all, because the reason text was the
same.

The hold now has its own reconcile trigger, `Trigger::QueueHold`, sent
through `reconcile::note_queue_held_behind` on every look at the hold,
for whichever session is the holder. The service lets it start an
attempt only when the holder row's last attempt began at least
`QUEUE_HOLD_MIN_SPACING` ago, whatever its backoff says. So a held row
costs at most one attempt per spacing, and it waits at most that
spacing plus one five-second recheck once the cause is over. Every
other ask is a map lookup.

The spacing is one minute. That is the service's own `BACKOFF_BASE` and
`HELD_WORK_RECHECK`, the spacing it keeps by itself after a row's first
failed attempt, so the hold never has a row tried more often than the
service already does. It only stops that spacing from growing while a
queue waits on the answer. One side effect: a holder that is still
working after its turn is checked every minute while a queue waits on
it, where the service alone would space those checks out to five.

The comment on `QUEUE_HOLD_RECHECK` says what a recheck now does.

Hold toast. When the drain finds a branch gone it forgets the branch's
attempts and sent nothing, so only the window that deleted the branch
dropped the "Queued session is waiting" toast. `forget_branch` now
reports whether a held row was among what it dropped, as
`retain_queued` does, and the drain sends the release event for it.

The frontend compares the notice heading against the hold's heading
instead of taking any heading for the hold notice. A notice under
another heading is shown under that heading without the hold toast's
id, and such a heading alone does nothing.

No data model changes and no new event.

Tests: a reconcile test pins one attempt per spacing whatever the
backoff, and the settle once the cause clears. The hold test now pins
that a disconnected holder is named on every look, and that a second
disconnected session of the same sibling is named with no new notice.
The attempts test covers what `forget_branch` reports, the wiring test
pins both take-back call sites in the drain and the new trigger call,
and the vitest file covers a notice under another heading.

Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
…f and pin the hold heading on both sides

Applies the warning and the suggestion of the review of 85b01e6, and
nothing else.

Backoff. A queued row held behind a sibling branch's `disconnected`
session has the holder tried once a minute, whatever its backoff says.
Each of those attempts that failed counted as a failure, so about six
minutes of hold over a failing holder left the service's next attempt
thirty minutes out. When the hold then ended with the holder still
disconnected (the queued row stopped or force-started, its branch
deleted or out of Running), the sweep left that session alone for up to
half an hour. The session's reconcile state also showed that next
attempt and a failure count growing by one a minute.

An attempt the hold asked for before the row's `next_attempt` was due
is now marked on the row when it begins (`RowState::ahead_of_schedule`,
in memory only). When it ends in a backoff, `failures` and
`next_attempt` stay as they were, so the service's own schedule after
the hold is what it would have been without the hold. The reason and
the phase are still recorded, and the log line gives the time left to
the standing next attempt. A hold attempt at or after the time the
service would have tried anyway is that attempt and counts as usual, as
does the first attempt on a row never tried. The held-work path is
unchanged.

The comment on `QUEUE_HOLD_MIN_SPACING` said the trigger only stops the
spacing growing. It now says the hold's attempts come on top of the
service's schedule and leave it alone.

Heading. The frontend tells the hold notice from any other by its
heading, which is a string literal on each side. The hold's wiring test
now asserts that `workspaceLifecycle.svelte.ts` contains
`failures::QUEUE_HELD_TITLE`, so a reworded Rust heading fails a test
instead of sending the notice down the other branch.

Tests: the reconcile test that pinned seven attempts with the sweep
refused now pins one counted failure and an unmoved next attempt after
six hold attempts, and that an ask once the service's attempt is due
counts as usual.

No data model changes and no event changes.

Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
@matt2e
matt2e force-pushed the blox-sometimes-has-main-checked-out branch from e294151 to 6f5a055 Compare November 20, 2026 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant